# -*- coding: utf-8 -*-
#! /usr/bin/python

# To change this template, choose Tools | Templates
# and open the template in the editor.


import sys
from PyQt4 import QtCore, QtGui
from editor import Ui_notepad

__author__="andrey"
__date__ ="$29.04.2010 13:33:29$"

class StartQt(QtGui.QMainWindow):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_notepad()
        self.ui.setupUi(self)
        QtCore.QObject.connect(self.ui.button_open, QtCore.SIGNAL("clicked()"),self.file_open)
        
    def file_open(self):
        import codecs
        open_dialog = QtGui.QFileDialog(self)
        self.ui.editor_window.setText(codecs.open(unicode(open_dialog.getOpenFileName()),'r','utf-8').read())
        
if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    myapp = StartQt()
    myapp.show()
    sys.exit(app.exec_())